<?php

abstract class Controller extends System{
	
	// Dentro de '/app/views/template' e sem o '.phtml'...
	protected $_templateName = "main";
	
	protected $template;
	
	protected $redirect;
	protected $haveCleanRest;
	
	public function __construct(){
		parent::__construct();
		$this->template = new ViewTemplate( $this->_templateName );
		$this->redirect = new RedirectHelper();
		$this->haveCleanRest = false;
	}
	
	private function view(){
		$this->template->set("base", BASE);
		$this->template->set("current.year", date("Y"));
		if( $this->template->hasValidContent() ){
			$this->template->content->set("base", BASE);
		}
		return $this->template->output($this->haveCleanRest);
	}
	
	protected function before() {}
	
	protected function after() {
		echo $this->view();
		$this->haveCleanRest = false;
	}
	
}

?>